﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using DLV.Utilities;

namespace DLV.Data.Entities
{
    public class LocationTypeController
    {
        public int InsertLocationType(LocationTypeInfo info)
        {
            return SQL.InsertLocationType(info.LocationTypeName, info.CreatedBy, info.CreatedDate, info.UpdatedBy, info.UpdatedDate, info.Status);
        }
        public void UpdateLocationType(LocationTypeInfo info)
        {
            SQL.UpdateLocationType(info.LocationTypeId, info.LocationTypeName, info.CreatedBy, info.CreatedDate, info.UpdatedBy, info.UpdatedDate, info.Status);
        }
        public void DeleteLocationType(LocationTypeInfo info)
        {
            DeleteLocationType(info.LocationTypeId);
        }
        public void DeleteLocationType(int locationTypeId)
        {
            SQL.DeleteLocationType(locationTypeId);
        }
        public LocationTypeInfo GetLocationType(int locationTypeId)
        {
            return CBO.FillObject<LocationTypeInfo>(SQL.GetLocationType(locationTypeId));
        }
        public List<LocationTypeInfo> ListLocationType()
        {
            return CBO.FillCollection<LocationTypeInfo>(SQL.ListLocationType());
        }
        public DataTable SelectLocationType()
        {
            return CBO.ConvertToDataTable(ListLocationType(), typeof(LocationTypeInfo));
        }
        public Dictionary<object, object> ListLocationTypeLookup()
        {
            var locations = ListLocationType();
            return locations.ToDictionary<LocationTypeInfo, object, object>(info => info.LocationTypeId, info => info.LocationTypeName);
        }
       
    }
}
